﻿Ext.override(NExt.Demo.Application.Entity.Bind.Edit, {

    templateShow: function() {
        this.region = 'center';

        //todo: fix width and height problem
        this.containerWindow = new Ext.Window({
            items: this,
            layout: 'border',
            width: 640,
            height: 480
        });

        this.containerWindow.show();
    },

    templateClose: function() {
        this.containerWindow.close();
    },

    templateSave: function() {
        var hasChanges = this.formPanel.isDirty();
        var currentModel = this.getCurrentModel();
        debugger;
    },

    findReference: function() {
        var referenceList = [{ Name: 'Baz1', LastName: 'Baz1' }, { Name: 'Baz2', LastName: 'Baz2' }, { Name: 'Baz3', LastName: 'Baz3'}];
        var findReferencePresenter = new NExt.Demo.Application.Entity.Bind.FindReference();
        findReferencePresenter.find(referenceList, this.tfReference.getModel(), this.findReferenceCallback, this);
    },

    findReferenceCallback: function(reference) {
        this.tfReference.setModel(reference);
    }

});
                                               
